package com.itheima.framework.view;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @program: Implementing springmvc
 * @description:
 * @author: zhanghz001
 * @create: 2020-12-05 11:23
 **/
public class ForwardViewHandler implements ViewHandler {
    @Override
    public void forward(HttpServletRequest request,
                        HttpServletResponse resp,
                        Object result) {
        try {
            System.out.println("转发中....." + result);
            request.getRequestDispatcher(result.toString()).forward(request, resp);
            // request.getRequestDispatcher("/WEB-INF/pages/one.jsp").forward(request, resp);
        } catch (ServletException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
